package com.imooc.framework.atomic;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

public class AtomicIntegerDemo implements Runnable{

    private static final AtomicInteger ATOMIC_INTEGER = new AtomicInteger(0);
    private static  Integer a = 0;
    @Override
    public void run() {
        ATOMIC_INTEGER.addAndGet(1);
//        a = a + 1 ;
        System.out.println(Thread.currentThread().getName() + " value :" + ATOMIC_INTEGER.get());
    }

    public static void main(String[] args) {
        AtomicIntegerDemo atomicIntegerDemo = new AtomicIntegerDemo();
        for (int i = 0; i < 10; i++) {
            new Thread(atomicIntegerDemo).start();
        }
    }
}
